//
//  UIBarButtonItem+Extension.swift
//  swiftWeiBo
//
//  Created by MJT on 16/7/9.
//  Copyright © 2016年 MJT. All rights reserved.
//

import UIKit
extension UIBarButtonItem {
    //提供便利构造函数
    convenience init(title: String ,target: AnyObject? ,action: Selector) {
        self.init()
        let button = UIButton()
        button.addTarget(target, action: action, forControlEvents: .TouchUpInside)
        button.setTitle(title, forState: .Normal)
        button.setTitleColor(UIColor.darkGrayColor(), forState: .Normal)
        button.setTitleColor(UIColor.orangeColor(), forState: .Highlighted)
        button.titleLabel?.font = UIFont.systemFontOfSize(15)
        button.sizeToFit()
        customView = button

    }
}
